package xiaohu.day3.HJ36;

import java.util.LinkedHashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        char[] key = in.nextLine().toCharArray();
        char[] wolds = in.nextLine().toCharArray();
        Set<Character> set = new LinkedHashSet<>();
        //去重
        for (char c : key) {
            set.add(c);
        }
        //把剩余的字母按顺序添加进去、
        //注意LinkedHashSet的特性，有序、不可重复、可为null、线程不安全
        int k = 0;
        while (set.size() < 26) {
            char c = (char)('a' + k);
            set.add(c);
            k++;
        }
        Object[] arr = set.toArray();
        StringBuilder builder = new StringBuilder();
        for (char c : wolds) {
            int n = c - 'a';//妙、找到对应的下标
            builder.append(arr[n]);
        }
        System.out.println(builder.toString());
    }
}
